using System;
using L=Science.Physics.GeneralPhysics;

namespace Serway.Chapter08
{
	/// <summary>
	/// Example07: Motion on a Curved Track
	/// A child of mass m rides on an irregularly curved slide 
	/// of height h = 2.00 m ,as shown in Figure 8.12 
	/// The child starts from rest at the top.
	/// (A) Determine his speed at the bottom, assuming no friction 
	/// is present.
	/// v_f = 6.26 m/s
	/// (B) If a force of kinetic friction acts on child, 
	/// how much mechanical energy does the system lose? 
	/// Assume that v_f =3.00 m/s and m=20.0 kg
	/// \Delta E = -302 J
	/// </summary>
	public class Example07
	{
		public Example07()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
			L.Mass m = new L.Mass();
			m.kg = 20.0;
			L.Work W = new L.Work();
			W.J = m.kg*L.Constant.AccelerationOfGravity*2.0;
			L.KineticEnergy Ki = new L.KineticEnergy();
			Ki.J = 0.0;
			L.KineticEnergy Kf = new L.KineticEnergy();
			Kf.VariableQ = true;
			L.FundamentalLaw.WorkEnergyTheorem(Ki,W,Kf);
			L.Velocity vf = new L.Velocity(m,Kf);
			result += Convert.ToString(vf.mPERs)+"\r\n";
            //(B)
			L.Velocity vpf = new L.Velocity();
			vpf.Z = 3.0;
			L.KineticEnergy Kpf = new L.KineticEnergy(m,vpf);
			result += Convert.ToString(Kpf.J - Kf.J);
		}
	}
}
